<template>
  <header class="header">
    <h1>小黑记事本</h1>
    <input placeholder="请输入任务" @keyup.enter='add' v-model.trim='newName' class="new-todo" />
    <button class="add" @click='add'>添加任务</button>
  </header>
</template>

<script>
export default {
    data(){
        return{
            newName:''
        }
    },
    methods:{
        add(){
            this.$emit('addList',this.newName)
            this.newName=''
        }
    }
}
</script>

<style>

</style>